import cgi

from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from framework.models import *

class MainPage(webapp.RequestHandler):
  def get(self):
      kind = self.request.get('kind')

      if (kind == 'placement' or kind == ''):
          placements = Placement.all()
          for placement in placements:
              placement.delete()
      
      if (kind == 'cdn' or kind == ''):
          cdns = CDN.all()
          for cdn in cdns:
              cdn.delete()

      if (kind == 'framework' or kind == ''):
          frameworks = Framework.all()
          for framework in frameworks:
              framework.delete()


application = webapp.WSGIApplication(
                                     [('/cleanup', MainPage)],
                                     debug=True)

def main():
  run_wsgi_app(application)

if __name__ == "__main__":
  main()